<h2>DESCRIPTION</h2>

<em>r.statistics</em> is a tool to analyse exploratory statistics of a categorical
"cover layer" according to how it intersects with objects in a "base layer".  A
variety of standard statistical measures are possible (called "zonal statistics"
in some GIS). 

All cells in the base layer are considered one object for the analysis.  For 
some applications, one will first want to prepare the input data so that
all areas of contiguous cell category values in the base layer are uniquely
identified, which can be done with <em>r.clump</em>.
<br>

The available methods are the following:
<ul>
<li>average deviation</li>
<li>average</li>
<li>diversity</li>
<li>kurtosis</li>
<li>maximum</li>
<li>median</li>
<li>minimum</li>
<li>mode</li>
<li>skewness</li>
<li>standard deviation</li>
<li>sum</li>
<li>variance</li>
</ul>

The calculations will be performed on each area of data of the
cover layers which fall within each unique value, or category, of the base layer.
<p>Setting the <em>-c</em> flag the category labels of the covering raster
layer will be used.  This is nice to avoid the GRASS limitation to integer
in raster maps because using category values floating point numbers can be
stored.

<p>All calculations create an output layer.  The output 
layer is a reclassified version of the base layer with identical
category values, but modified category labels - the results of the calculations
are stored in the category labels of the output layer.

<h2>NOTES</h2>

For floating-point cover map support, see the alternative
<em><a href="r.stats.zonal.html">r.stats.zonal</a></em>.

For quantile calculations with support for floating-point cover maps, see the
alternative <em><a href="r.stats.quantile.html">r.stats.quantile</a></em>.

<h2>EXAMPLES</h2>

Calculation of average elevation of each field in the Spearfish region:

<div class="code"><pre>
r.statistics base=fields cover=elevation.dem out=elevstats method=average
r.category elevstats
r.mapcalc "fieldelev = @elevstats"
r.univar fieldelev
</pre></div>

<h2>SEE ALSO</h2>
<em>
<a href="r.category.html">r.category</a>,
<a href="r.clump.html">r.clump</a>,
<a href="r.mode.html">r.mode</a>,
<a href="r.mapcalc.html">r.mapcalc</a>,
<a href="r.neighbors.html">r.neighbors</a>,
<a href="r.stats.quantile.html">r.stats.quantile</a>,
<a href="r.stats.zonal.html">r.stats.zonal</a>,
<a href="r.univar.html">r.univar</a>
</em>

<h2>AUTHOR</h2>
Martin Schroeder, Geographisches Institut Heidelberg, Germany

<!--
<p>
<i>Last changed: $Date$</i>
-->
